package ee.objectCloner.guice;

import com.google.inject.AbstractModule;
import com.google.inject.TypeLiteral;
import com.google.inject.multibindings.Multibinder;
import com.google.inject.name.Names;

import ee.objectCloner.CloneAdvisor;
import ee.objectCloner.CustomCloner;
import ee.objectCloner.ObjectCloner;

public class ObjectClonerModule extends AbstractModule {

	@Override
	protected void configure() {
		bind(ObjectCloner.class).to(GuiceObjectCloner.class).asEagerSingleton();
		bind(CustomCloner.class).annotatedWith(Names.named("defaultCloner")).to(GuiceDefaultCloner.class).asEagerSingleton();
		
		//TODO document how we can add these
		Multibinder.newSetBinder(binder(), CustomCloner.class, Names.named("customCloners"));
		Multibinder.newSetBinder(binder(), new TypeLiteral<Class<?>>() {}, Names.named("immutables"));
		Multibinder.newSetBinder(binder(), CloneAdvisor.class, Names.named("cloneAdvisors"));
	}

}
